﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp6
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入矩阵的大小：");
            try
            {
                int m = Int32.Parse(Console.ReadLine());
                int n = Int32.Parse(Console.ReadLine());
                int[,] matrix = new int[m, n];
                Console.WriteLine("请输入矩阵的元素：");
                for (int i = 0; i < m; i++)
                    for (int j = 0; j < n; j++)
                        matrix[i, j] = Int32.Parse(Console.ReadLine());
                bool isTheToplitzmatrix = false;
                for (int i = 0; i < m && i < n; i++)
                {
                    if (matrix[i, i] != matrix[0, 0])
                        break;
                    else if (i == m - 1 || i == n - 1)
                        isTheToplitzmatrix = true;
                }
                if (isTheToplitzmatrix == true)
                    Console.WriteLine("True");
                else
                    Console.WriteLine("False");
            }
            catch
            {
                Console.WriteLine("输入异常");
            }
        }
    }
}
